Convert Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Convert a collection of items by applying a delegate to each item in the collection. The resulting collection contains the result of applying converter to each item in sourceCollection, in order.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static IEnumerable<TDest> Convert<TSource, TDest>(
	IEnumerable<TSource> sourceCollection,
	Converter<TSource, TDest> converter
)
Visual Basic (Declaration)
Public Shared Function Convert(Of TSource, TDest) ( _
	sourceCollection As IEnumerable(Of TSource), _
	converter As Converter(Of TSource, TDest) _
) As IEnumerable(Of TDest)
Visual C++
public:
generic<typename TSource, typename TDest>
static IEnumerable<TDest>^ Convert (
	IEnumerable<TSource>^ sourceCollection, 
	Converter<TSource, TDest>^ converter
)

Parameters

sourceCollection
IEnumerable<(Of <TSource>)>
The collection of item being converted.
converter
Converter<(Of <TSource, TDest>)>
A delegate to the method to call, passing each item in sourceCollection.

Return Value

The resulting collection from applying converter to each item in sourceCollection, in order.

Type Parameters

TSource
The type of items in the collection to convert.
TDest
The type each item is being converted to.

Exceptions

ExceptionCondition
System..::ArgumentNullExceptionsourceCollection or converter is null.

See Also